import React, { useCallback } from 'react';
import { Table, Tabs } from "../../functionalComponent";
import { getCompletedNodeInfo, getUnHandledNodeInfo } from "./service";

/**
 * @description 已办节点tabkey
 */
import { Fragment as _Fragment } from "react/jsx-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
var TAB_COMPLETED_KEY = '1';

/**
 * @description 未办节点tabkey
 */
var TAB_UNHANDLED_KEY = '2';
var WFApprovalProgress = function WFApprovalProgress(props) {
  var taskId = props.taskId;
  var columns = [{
    dataIndex: 'rows',
    title: '序号',
    width: 80,
    align: 'center',
    render: function render(row) {
      return /*#__PURE__*/_jsx(_Fragment, {
        children: row.rowIndex + 1
      });
    }
  }, {
    title: '节点名称',
    dataIndex: 'nodeName'
  }];

  /**
   * @description 获取已办节点信息
   */
  var queryCompletedNodeInfo = useCallback(function (_ref) {
    var pageIndex = _ref.pageIndex,
      pageSize = _ref.pageSize;
    return getCompletedNodeInfo({
      taskId: taskId,
      pageSize: pageSize,
      pageIndex: pageIndex
    });
  }, []);

  /**
   * @description 获取待办节点信息
   */
  var queryUnHandledNodeInfo = useCallback(function (_ref2) {
    var pageIndex = _ref2.pageIndex,
      pageSize = _ref2.pageSize;
    return getUnHandledNodeInfo({
      taskId: taskId,
      pageSize: pageSize,
      pageIndex: pageIndex
    });
  }, []);

  // tabs配置项
  var tabItems = [{
    key: TAB_COMPLETED_KEY,
    label: '已办节点',
    children: /*#__PURE__*/_jsx(Table, {
      request: queryCompletedNodeInfo,
      columns: columns,
      bordered: true,
      pagination: true,
      style: {
        height: 360
      }
    })
  }, {
    key: TAB_UNHANDLED_KEY,
    label: '未办节点',
    children: /*#__PURE__*/_jsx(Table, {
      request: queryUnHandledNodeInfo,
      columns: columns,
      bordered: true,
      pagination: true,
      style: {
        height: 360
      }
    })
  }];
  return /*#__PURE__*/_jsx("div", {
    style: {
      padding: '5px 20px 0 20px'
    },
    children: /*#__PURE__*/_jsx(Tabs, {
      defaultActiveKey: "1",
      items: tabItems
    })
  });
};
export default WFApprovalProgress;